package com.wang.interview.tests.CASandVolatile;

import org.junit.Test;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author: wang
 * @date: 2021/8/8 19:59
 * @description:
 */
public class T0 {
    @Test
    public void test01(){
        // CAS
        AtomicInteger atomicInteger = new AtomicInteger();
        atomicInteger.set(1);
        atomicInteger.compareAndSet(1, 10);
        atomicInteger.compareAndSet(1, 6);
        System.out.println(atomicInteger.get());  // 10
    }
    @Test
    public void test02(){

    }
    @Test
    public void test03(){}
    @Test
    public void test04(){}
    @Test
    public void test05(){}
    @Test
    public void test06(){}
    @Test
    public void test07(){}
    @Test
    public void test08(){}
    @Test
    public void test09(){}
    @Test
    public void test10(){}
}
